package iwpl.project.entities;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Offices entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "Offices")
public class Offices implements java.io.Serializable {

	// Fields

	private Integer id;
	private Departments departments;
	private String officeName;
	private String phone;
	private String address;
	private Set<Employees> employeeses = new HashSet<Employees>(0);

	// Constructors

	/** default constructor */
	public Offices() {
	}

	/** minimal constructor */
	public Offices(Integer id) {
		this.id = id;
	}

	/** full constructor */
	public Offices(Integer id, Departments departments, String officeName,
			String phone, String address, Set<Employees> employeeses) {
		this.id = id;
		this.departments = departments;
		this.officeName = officeName;
		this.phone = phone;
		this.address = address;
		this.employeeses = employeeses;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "ID", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "DepartmentID")
	public Departments getDepartments() {
		return this.departments;
	}

	public void setDepartments(Departments departments) {
		this.departments = departments;
	}

	@Column(name = "OfficeName")
	public String getOfficeName() {
		return this.officeName;
	}

	public void setOfficeName(String officeName) {
		this.officeName = officeName;
	}

	@Column(name = "Phone", length = 24)
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Column(name = "Address")
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "offices")
	public Set<Employees> getEmployeeses() {
		return this.employeeses;
	}

	public void setEmployeeses(Set<Employees> employeeses) {
		this.employeeses = employeeses;
	}

}